﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using SdlDotNet.Graphics.Sprites;
using SdlDotNet.Graphics;
using System.IO;

using SdlDotNet.Input;

namespace bloodbox
{
    class BBUI
    {
        static private Surface UIscreen;
        static private BBConsole UIconsole;
        static private Surface GUIBackground = new Surface(Path.Combine("gui", "gui.png"));

        Point PointZero = new Point(0, 0);

        public BBUI(Surface screen, BBConsole console)
        {
            UIscreen = screen;
            UIconsole = console;
        }

        // Should be in the actor drawing class
        /*protected void drawActorHealth(int value, int max, Point point)
        {
            Color color;
            int percent_value = 0;

            // Net yet implemented
            if (true) color = Color.Blue; // If it's a player
            else color = Color.Red;       // If it's a monster

            percent_value = (int)(value * 100 / max);

            UIscreen.Fill(new Rectangle(point, new Size(100, 6)), Color.Gray);
            UIscreen.Fill(new Rectangle(point, new Size(percent_value, 6)), Color.Blue);
        }*/

        protected void drawConsole()
        {
            UIscreen.Blit(UIconsole.getConsole(), new Point(30, 660));  
        }

        protected void drawPlayerInformations()
        {
            Random rnd = new Random();

            // Health
            UIscreen.Fill(new Rectangle(new Point(450,10), new Size(120, 10)), Color.Gray);
            UIscreen.Fill(new Rectangle(new Point(450, 10), new Size(rnd.Next(0, 120), 10)), Color.Blue);
            // Mana
            UIscreen.Fill(new Rectangle(new Point(450, 30), new Size(120, 10)), Color.Gray);
            UIscreen.Fill(new Rectangle(new Point(450, 30), new Size(rnd.Next(0, 120), 10)), Color.Green);  
        }

        // Main drawing function
        public void Draw()
        {
            // Draw the background first
            UIscreen.Blit(GUIBackground, PointZero);
            // Then draw the console
            drawConsole();
            // Then draw the player informations
            drawPlayerInformations();
        }

        // Update function
        public void Update()
        {
                        
        }
    }
}
